<html>
<head><meta charset="utf-8"><title>requesting non-alignment · t-compiler · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/index.html">t-compiler</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/requesting.20non-alignment.html">requesting non-alignment</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="136057044"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/requesting%20non-alignment/near/136057044" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/requesting.20non-alignment.html#136057044">(Oct 18 2018 at 17:05)</a>:</h4>
<p><span class="user-mention" data-user-id="123586">@nagisa</span> this might be a super -silly question: Is there a way to ask LLVM to always keep a value at some <em>offset</em> from a given alignment? (Apart workarounds like putting the value as the second field in a packed struct, which would be the most immediate way I would try to encode such a thing)</p>



<a name="136057350"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/requesting%20non-alignment/near/136057350" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/requesting.20non-alignment.html#136057350">(Oct 18 2018 at 17:10)</a>:</h4>
<p>uhh, not sure about "some offset"</p>



<a name="136057353"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/requesting%20non-alignment/near/136057353" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/requesting.20non-alignment.html#136057353">(Oct 18 2018 at 17:10)</a>:</h4>
<p>if it is 0, then doing so is pretty easy</p>



<a name="136057471"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/requesting%20non-alignment/near/136057471" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Hanna Kruppe <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/requesting.20non-alignment.html#136057471">(Oct 18 2018 at 17:13)</a>:</h4>
<p>LLVM barely even deals with alignments of fields, so I'm rather sure that isn't a thing</p>



<a name="136057472"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/requesting%20non-alignment/near/136057472" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/requesting.20non-alignment.html#136057472">(Oct 18 2018 at 17:13)</a>:</h4>
<p>if it is not <code>0</code> then what you might end up having to do is something along the lines of </p>
<div class="codehilite"><pre><span></span><span class="nv">%X</span> <span class="p">=</span> <span class="k">type</span> <span class="p">&lt;{</span> <span class="p">[</span><span class="err">offset</span> <span class="k">x</span> <span class="k">i8</span><span class="p">],</span> <span class="nv">%Y</span><span class="p">,</span> <span class="p">[</span><span class="m">0</span> <span class="k">x</span> <span class="k">i8</span><span class="p">]</span> <span class="p">}&gt;</span>
</pre></div>



<a name="136057548"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/requesting%20non-alignment/near/136057548" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/requesting.20non-alignment.html#136057548">(Oct 18 2018 at 17:14)</a>:</h4>
<p>(then given <code>%X</code> is aligned to your "given alignment", then <code>%Y</code> will be offset from that by <code>offset</code>)</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>